//package com.tools.excel;
//
//import java.util.Date;
//import java.util.List;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.poi.xssf.streaming.SXSSFWorkbook;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import cn.com.dgpost.oms_server.model.invt.InvtFilter;
//import cn.com.dgpost.oms_server.pojo.invt.basic.Stock;
//import cn.com.dgpost.oms_server.pojo.invt.in.Stockin;
//import cn.com.dgpost.oms_server.pojo.invt.in.StockinDetail;
//import cn.com.dgpost.oms_server.pojo.purchs.Purchs;
//import cn.com.dgpost.oms_server.pojo.purchs.PurchsDetail;
//import cn.com.dgpost.taglib.TransSingleTag;
//import cn.com.dgpost.tools.time.DateUtils;
//
//public class ExcelTest {
//
//	public void stockinExport(InvtFilter filter, HttpServletRequest request, HttpServletResponse response) throws Exception{
//		Stock stock = null;
//		String filename="入库单_"+stock.getStockName()+"_"+DateUtils.formatDate(new Date(), "yyMMddHHmm")+".xls";
//		List<Stockin> inList = null;
//		
//		SXSSFWorkbook workBook = export(inList);
//		ExcelUtils.export(filename, workBook, response);
//	}
//	
//	public SXSSFWorkbook export(List<Stockin> orderList) {
//		XSSFExport xls = new XSSFExport();
//		xls.createRow(0);// 创建表头
//		String[] header ={"入库单号","收货仓库","单据类型","状态","下单时间","采购单号","采购编码","供应商","SKU","商品名称","商品备注","来料数量","金额","采购员"}; 
//		xls.setTableHeader(header);
//		// 获取内容
//		int rowNum = 1;
//		for(Stockin order : orderList){
//			for(StockinDetail sd : order.getDetails()){
//				xls.createRow(rowNum);
//				xls.setCell(0, order.getOrderId());
//				xls.setCell(1, order.getStock()==null?"":order.getStock().getStockName());
//				xls.setCell(2, order.getOrderType()==null?"":TransSingleTag.translateDict(order.getOrderType(), "INVT_TYPE"));
//				xls.setCell(3, order.getOrderStatus()==null?"":TransSingleTag.translateDict(order.getOrderStatus(), "STOCKIN_STATUS"));
//				xls.setCell(4, order.getOrderDate()==null?"":DateUtils.formatDate(order.getOrderDate()));
//				
//				Purchs po = null;
//				xls.setCell(5, po==null?"":po.getOrderId().toString());
//				xls.setCell(6, po==null?"":po.getPurchsCode());
//				xls.setCell(7, (po!=null&&po.getSupplier()!=null)?po.getSupplier().getSupplierName():"");
//				
//				xls.setCell(8, sd.getProduct().getSku());
//				xls.setCell(9, sd.getProduct().getProductName());
//				xls.setCell(10, sd.getProduct().getRemark());
//				xls.setCell(11, sd.getRealQty()==null?0:sd.getRealQty());
//				
//				if(po!=null){
//					for( PurchsDetail pd : po.getDetails()){
//						if(sd.getProduct().getProductId().equals(pd.getProduct().getProductId())){
//							xls.setCell(12, pd.getPrice()==null?0d:pd.getPrice());
//						}
//					}
//				}else{
//					xls.setCell(12, "");
//				}
//				xls.setCell(13, po==null?"":po.getOperator().getRealName());
//				
//				rowNum++;
//			}
//		}
//		return xls.getWorkbook();
//	}
//	
//}